#!/bin/sh
#
# Copyright (c) 2007-2009 The PureDarwin Project.
# All rights reserved.
#
# @LICENSE_HEADER_START@
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# @LICENSE_HEADER_END@
#

#
# aladin   <aladin@puredarwin.org>
# probono <probono@puredarwin.org>
#

#
# Hold configuration information needed by other scripts
#

#
# Changelog
#
# 20090326 - Please, see `hg log' or `svn log' from now (Mercurial) - aladin
# 20081219 - Added 9G55 and 9G55pd1 (experimental patched packages) - aladin
# 20081210 - Added 9F33pd1 (experimental patched packages) - aladin
# 20081209 - License header update - aladin
# 20080921 - Added 9F33 version in BINVERSION - aladin
# 20080803 - Added 9E17 and 9D34 versions in BINVERSION - aladin
# 20080606 - Cleaned up - aladin
# 20080528 - Minor updates - aladin
# 20080522 - Cleaned up, removed Darwin 8, PureDarwin starts with Darwin 9
#            releases - probono
# 20080522 - Changed order of buildVersions used, newest first - probono
# 20080305 - Initial release - aladin
#

# Darwin release (major version)
#
DARWIN_RELEASE="9"
#DARWIN_RELEASE="10"

#
# Processor architecture / mach-o format
#
ARCH="i386"
#ARCH="ppc"    # FIXME could work on D9 (need to check thin, OpenFirmware and bootloaders)
#ARCH="x86_64" # FIXME does not (yet) work

#
# PureDarwin release (flavor)
#
if [ "$PUREDARWIN_RELEASE" = "" ]; then
	PUREDARWIN_RELEASE=""
	#PUREDARWIN_RELEASE="bootstrap"
	#PUREDARWIN_RELEASE="nano"
# else
	# FIXME add check(s)
fi

#
# Binaryroot projects list local file
#
# FIXME some project names have changed between D9 and D10
if [ "$BINARYROOTS_LIST_FILE" = "" ]; then

	if [ "$PUREDARWIN_RELEASE" = "" ]; then
		BINARYROOTS_LIST_FILE="pd_roots"
	fi

	if [ "$PUREDARWIN_RELEASE" = "bootstrap" ]; then
		BINARYROOTS_LIST_FILE="pd_roots.bootstrap"
	fi

	if [ "$PUREDARWIN_RELEASE" = "nano" ]; then
		BINARYROOTS_LIST_FILE="pd_roots.nano"  
	fi
#else
	# FIXME add check(s)
fi

#
# Extra Binaryroot projects list local file (e.g. PureFoundation)
#
# FIXME D9 and D10 separation
BINARYROOTS_EXTRA_LIST_FILE="pd_roots.extra"  

#
# Temporary dir which will contain fetched and thinned binaryroots
#
TEMPDIR="pd_tmp"

#
# Where fetched binary roots/drivers are (unpacked/thinned/)repacked (e.g., "./Packages_${ARCH}/")
#
DESTDIR="$TEMPDIR/Packages_D${DARWIN_RELEASE}_${ARCH}" # ...D9_i386 or D10_i386

# Default local binary roots dir
BINARYROOTS_DEFAULT_DIR="$TEMPDIR/Roots"

#
# Additional local directories of binary roots and binary drivers
#
BINARYROOTS_DIR=(
	"$TEMPDIR/BinaryDrivers"
#	"$TEMPDIR/x"
#	"$TEMPDIR/y"
#	"$TEMPDIR/z"
)

#
# Dir of darwinbuild build directories
#
# WARNING: The binaryroots built on your local computer can,
# depending on the constellation of your buildroot resulting
# in problematic relation between dependents and dependencies.
#
# First Roots/.DownloadCache/ is checked then Packages/ if nothing found
#DARWINBUILD_DIR="/Users/aladin/PureDarwin/darwinbuild"


#
# Binary roots, drivers and external repository url  (if not found locally)
#
BINARYROOTS_HTTP_PATH=(
	"http://src.macosforge.org/BinaryDrivers"
	"http://src.macosforge.org/Roots"
)

#
# Build versions in Darwin 9 and Darwin 10
#
BINVERSION=(10C540 10B504 10A432 pd 9J61pd1 9G55pd1 9F33pd1 9L30 9J61 9G55 9F33 9E17 9D34 9C31 9B18 9A581)


#
# Default Darwin 9 full options
#
#
# WARNING: Exclusivity is not always obvious but exists between choices.

ADD_CHAMELEON="y"		# (default: y) Add Chameleon bootloader?
#ADD_CHAMELEON_THEMES="y"	# (default: y) Add Chameleon bootloader themes?
ADD_CHAMELEON_RC1="n"		# (default: n) EXCLUSIVE Choose Chameleon 2.0-RC1-r431?
ADD_CHAMELEON_RC2="n"		# (default: n) EXCLUSIVE Choose Chameleon 2.0-RC2-r640?
ADD_CHAMELEON_RC3="n"		# (default: n) EXCLUSIVE Choose Chameleon 2.0-RC3-r658?
ADD_CHAMELEON_RC4="y"		# (default: n) EXCLUSIVE Choose Chameleon 2.0-RC4-r684?

ADD_MBR_ERASE="y"		# (default: y) Erase existing partition table (instead of updating the MBR)?

ADD_HFS_JOURNAL="y"		# (default: y) Create a journaled HFS+ volume

ADD_VOODOO_XNU="y"		# (default: y) Add Voodoo Xnu-dev kernels ?
# On 9.7, problems with disk0s1: ioctl(_IOW,'d',31,32) is unsupported
ADD_VOODOO_XNU_9_5_0="y"	# (default: y) EXCLUSIVE Choose Voodoo 9.5.0 Kernel Release 1.0 Package (Rev A)
ADD_VOODOO_XNU_9_7_0="n"	# (default: n) EXCLUSIVE Choose Voodoo 2 -- alpha 3 -- (based on XNU 9.7.0, for Intel only)

ADD_VOODOO_XNU_SPEEDSTEP="n"	# (default: n) Add xnu-speedstep (Intel SpeedStep driver)?
ADD_VOODOO_POWER_MINI="n"	# (default: n) Add VoodooPowerMini Kext (v 1.2.4)?

ADD_PUREFOUNDATION="y"		# (default: y) Add PureFoundation enhancements?

# FIXME Add switch for network support

ADD_VOODOO_PS2CONTROLLER="y"	# (default: y) EXCLUSIVE Add VoodooPS2Controller (VoodooPS2Controller, VoodooPS2Keyboard, VoodooPS2Mouse, VoodooPS2Trackpad)?
ADD_DFE_PS2CONTROLLER="n"	# (default: n) EXCLUSIVE Add David Elliott PS2 support (ACPIPS2Nub, ApplePS2Controller)?

ADD_VMWARE="y"			# (default: y) Add VMware support (VMware-Drivers-OpenSource & VMwareIOFramebuffer.kext)?
ADD_VMWARE_VMDK="y"		# (default: y) Add VMware VMDK disk image (read-write support)?
ADD_VMWARE_IDE_DRIVE="n" 	# (default: n) Additional IDE disk drive in the vmwarevm

ADD_FB_640x480x32="n"		# (default: n) EXCLUSIVE Add 640x480x32  framebuffer resolution?
ADD_FB_800x600x32="y"		# (default: y) EXCLUSIVE Add 800x600x32  framebuffer resolution? 
ADD_FB_1024x768x32="n"		# (default: n) EXCLUSIVE Add 1024x768x32 framebuffer resolution? 

ADD_MACFUSE="y"			# (default: n) Add MacFUSE support (http://www.puredarwin.org/developers/macfuse)
ADD_MACFUSE_RAMDISK="y"		# (default: n) Add ramdisk in MacFUSE (http://thebends.googlecode.com)
ADD_MACFUSE_SSHFS="y"		# (default: n) Add sshfs in MacFUSE

ADD_LOGIN="y"			# (default: y) Add multiuser login support (pamsessioncreate, pcsc)

ADD_DEFAULT_USER="y"		# (default: y) Add a default user account: toor (password: toor)?

ADD_X="y"			# (default: n) Add X and other related binaryroots?
ADD_KEYMAP_BELGE="n"		# (default: n) EXCLUSIVE Add X Belge keymapping?
ADD_KEYMAP_DEUTSCH="n"		# (default: n) EXCLUSIVE Add X Deutsch keymapping? 
ADD_KEYMAP_FRANCAIS="n"		# (default: n) EXCLUSIVE Add X Francais keymapping?
ADD_KEYMAP_UK="n"		# (default: n) EXCLUSIVE Add X UK keymapping?
ADD_KEYMAP_USA="y"		# (default: y) EXCLUSIVE Add X USA keymapping?

ADD_WMAKER="n"			# (default: n) Add WindowMaker (default window manager)?

ADD_DEBUG="y"			# (default: y) Add debug (verbose launchd and persistent logs in /var/log/syslog)?

ADD_BASH="y"			# (default: y) EXCLUSIVE Add the Bash shell as default shell? 
ADD_BASHRC="y"			# (default: y) Add /etc/bashrc? 
				# (depends: ADD_BASH)
ADD_ZSH="n"			# (default: n) EXCLUSIVE Add the Zsh shell as default shell? 
ADD_ZSHRC="y"			# (default: y) Add /etc/zshrc? 
				# (depends: ADD_ZSH)

ADD_DEVELOPER="y"		# (default: y) Do you want to keep developer headers and libraries?

ADD_MACPORTS_TCL="y"		# (default: y) Do you want to add TCL built with the MacPorts project?

ADD_SETTINGS_FILES="y"		# (default: y) Add all settings files from PureDarwinSettings

ADD_RELEASE_NANO="n"		# (default: n) Build a nano release instead of a full one?

ADD_CLONE="y"                   # (default: n) Add setup scripts to the target (bootstrap -> full)?
ADD_CLONE_PACKAGES="n"          # (default: n) Add setup binaryroots to the target (bootstrap -> full)?

ADD_LAUNCHD="y"			# (default: y) Add launchd as the first process spawned by the kernel
ADD_LAUNCHD_GETTY="y"		# (default: y) EXCLUSIVE Add default login prompt launched by launchd
ADD_LAUNCHD_NANOSHELL="n"	# (default: n) EXCLUSIVE Add a synthetic custom "shell" launched by launchd
ADD_LAUNCHD_INSTALLER="n"	# (default: n) EXCLUSIVE Add a synthetic custom "shell" launched by launchd

ADD_LAUNCHD_MDNSRESPONDER="y"	# (default: y) Add mDNSResponder launched by launchd
ADD_LAUNCHD_PORTMAP="y"		# (default: y) Add portmap launched by launchd
ADD_LAUNCHD_STATD="y"		# (default: y) Add statd launched by launchd

ADD_DTRACE="y"			# (default: n) Add DTrace

ADD_KEXTCACHE="n"		# (default: y) Add creation of kext cache file

# 
# Darwin 10 full options
#
if [ "$DARWIN_RELEASE" = "10" ]; then
	ADD_VOODOO_XNU="n"	# No because not yet released for D10
	ADD_PUREFOUNDATION="n"	# No because not yet compiled for D10
fi

#
# Generic nano options
#
if [ "$PUREDARWIN_RELEASE" = "nano" ]; then
	ADD_RELEASE_NANO="y"		# Switch used in pd_setup

	ADD_HFS_JOURNAL="n"		# (default: y) Create a journaled HFS+ volume

	ADD_PUREFOUNDATION="n"

	ADD_MACFUSE="n"			# (default: n) Add MacFUSE support (http://www.puredarwin.org/developers/macfuse)
	ADD_MACFUSE_RAMDISK="n"		# (default: n) Add ramdisk in MacFUSE (http://thebends.googlecode.com)
	ADD_MACFUSE_SSHFS="n"		# (default: n) Add sshfs in MacFUSE

	ADD_LOGIN="n"	      
	ADD_DEFAULT_USER="n"
	ADD_X="n"
	ADD_DEBUG="n"
	ADD_DEVELOPER="n"
	ADD_MACPORTS="n"
	ADD_MACPORTS_TCL="n"
	ADD_VMWARE_VMDK="n"
	ADD_SETTINGS_FILES="n"		# (default: y) Add all settings files from PureDarwinSettings

	ADD_CLONE="n"                   # (default: n) Add setup scripts to the target (bootstrap -> full)?
	ADD_CLONE_PACKAGES="n"          # (default: n) Add setup binaryroots to the target (bootstrap -> full)?

	ADD_LAUNCHD="n"			# (default: y) Add launchd as the first process spawned by the kernel
	ADD_LAUNCHD_GETTY="n"		# (default: y) EXCLUSIVE Add default login prompt launched by launchd
	ADD_LAUNCHD_NANOSHELL="n"	# (default: n) EXCLUSIVE Add a synthetic custom "shell" launched by launchd
	ADD_LAUNCHD_INSTALLER="n"	# (default: n) EXCLUSIVE Add a synthetic installer launched by launchd
					# (depends: ADD_CLONE; ADD_LAUNCHD)

	ADD_LAUNCHD_MDNSRESPONDER="n"	# (default: y) Add mDNSResponder launched by launchd
	ADD_LAUNCHD_PORTMAP="n"		# (default: y) Add portmap launched by launchd
	ADD_LAUNCHD_STATD="n"		# (default: y) Add statd launched by launchd
					
	ADD_DTRACE="n"			# (default: n) Add DTrace
fi

#
# Generic bootstrap options (nano++) which deploy a full release
#
if [ "$PUREDARWIN_RELEASE" = "bootstrap" ]; then
	ADD_RELEASE_NANO="y"		# Similar to nano with many switches used in `pd_setup'

	ADD_HFS_JOURNAL="n"		# (default: y) Create a journaled HFS+ volume
	
	ADD_PUREFOUNDATION="y"	
	
	ADD_MACFUSE="y"			# (default: n) Add MacFUSE support (http://www.puredarwin.org/developers/macfuse)
	ADD_MACFUSE_RAMDISK="y"		# (default: n) Add ramdisk in MacFUSE (http://thebends.googlecode.com)
	ADD_MACFUSE_SSHFS="y"		# (default: n) Add sshfs in MacFUSE

	ADD_LOGIN="n"			# (default: y) Add multiuser login support (pamsessioncreate, pcsc)
	ADD_DEFAULT_USER="n"		# (default: y) Add a default user account: toor (password: toor)?
	ADD_X="n"
	ADD_DEBUG="n"
	ADD_DEVELOPER="n"
	ADD_MACPORTS="n"
	ADD_MACPORTS_TCL="n"
	
	ADD_VMWARE_VMDK="n"

	ADD_VMWARE_IDE_DRIVE="y" 	# (default: n) Additional IDE disk drive in the vmwarevm
	ADD_SETTINGS_FILES="n"		# (default: y) Add all settings files from PureDarwinSettings

	ADD_CLONE="y"                   # (default: n) Add copy of setup scripts to the target
	ADD_CLONE_PACKAGES="y"          # (default: n) Add copy of setup binaryroots to the target

	# On 9.7, problems with disk0s1: ioctl(_IOW,'d',31,32) is unsupported
	ADD_VOODOO_XNU_9_5_0="y"	# (default: y) EXCLUSIVE Choose Voodoo 9.5.0 Kernel Release 1.0 Package (Rev A)
	ADD_VOODOO_XNU_9_7_0="n"	# (default: n) EXCLUSIVE Choose Voodoo 2 -- alpha 3 -- (based on XNU 9.7.0, for Intel only)

	ADD_VOODOO_XNU_SPEEDSTEP="n"	# (default: n) Add xnu-speedstep (Intel SpeedStep driver)?
	ADD_VOODOO_POWER_MINI="n"	# (default: n) Add VoodooPowerMini Kext (v 1.2.4)?


	ADD_LAUNCHD="y"			# (default: y) Add real launchd as the first process spawned by the kernel?

	ADD_LAUNCHD_GETTY="n"		# (default: y) EXCLUSIVE Add default login prompt launched by launchd
	ADD_LAUNCHD_NANOSHELL="n"	# (default: n) EXCLUSIVE Add a synthetic custom "shell" launched by launchd
	ADD_LAUNCHD_INSTALLER="y"	# (default: n) EXCLUSIVE Add a synthetic installer launched by launchd
					# (depends: ADD_CLONE; ADD_LAUNCHD)

	ADD_LAUNCHD_MDNSRESPONDER="n"	# (default: y) Add mDNSResponder launched by launchd
	ADD_LAUNCHD_PORTMAP="n"		# (default: y) Add portmap launched by launchd
	ADD_LAUNCHD_STATD="n"		# (default: y) Add statd launched by launchd
	
	ADD_DTRACE="n"			# (default: n) Add DTrace
fi

